package org.apache.doris.demo.spring;

import com.alibaba.fastjson.JSONArray;
import org.apache.doris.demo.spring.controller.UserProfileController;
import org.apache.doris.demo.spring.model.UserTag;

import java.util.*;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
        List<List<String>> stringLists = new ArrayList<>();
        stringLists.add(Arrays.asList("apple", "banana", "cherry"));
        stringLists.add(Arrays.asList("orange", "grape"));
        stringLists.add(Arrays.asList("watermelon"));

        List<Map<String, String>> stringMapList = stringLists.stream()
                .flatMap(List::stream)
                .map(s -> {
                    Map<String, String> map = new HashMap<>();
                    map.put("name", s);
                    return map;
                })
                .collect(Collectors.toList());

//        System.out.println(stringMapList);
//
//        List<UserProfileController.Data> dataList = new ArrayList<>();
//        Random random = new Random();
//        List<String> list = Arrays.asList("test", "test1");
//        for (String userTag : list) {
//            UserProfileController.Data data=new UserProfileController.Data();
//            int value = random.nextInt(10000 - 1000 + 1) + 1000;
//            data.setName(userTag);
//            data.setValue(value);
//            dataList.add(data);
//        }
//        dataList.forEach(System.out::println);




        List<Map<String, Object>> dataList1 = new ArrayList<>();

        Map<String, Object> data1 = new HashMap<>();
        data1.put("name", "Macys");
        data1.put("value", 6181);
        dataList1.add(data1);

        JSONArray jsonArray = new JSONArray();
        Map<String, Object> data2 = new HashMap<>();
        data2.put("name", "AmySchumer");
        data2.put("value", 4386);
        jsonArray.add(data2);
        data2 = new HashMap<>();
        data2.put("name", "AmySchumer");
        data2.put("value", 4386);
        jsonArray.add(data2);
        System.out.println(jsonArray.toString());
    }
}